package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.*;
import cn.wolfcode.trip.base.mapper.TravelPaperContentMapper;
import cn.wolfcode.trip.base.mapper.TravelPaperMapper;
import cn.wolfcode.trip.base.mapper.VisaManagerMapper;
import cn.wolfcode.trip.base.mapper.VisaPriceMapper;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.query.TravelPaperQuery;
import cn.wolfcode.trip.base.service.ITravelPaperService;
import cn.wolfcode.trip.base.service.IVisaService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class VisaServiceImpl implements IVisaService{

    @Autowired
    private VisaPriceMapper visaPriceMapper;

    @Autowired
    private VisaManagerMapper visaManagerMapper;



    @Override
    public PageInfo selectForListPrice(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<VisaPrice> list = visaPriceMapper.selectForList(qo);
        return new PageInfo(list);
    }

    @Override
    public List<VisaPrice> selectAll() {
        return visaPriceMapper.selectAll();
    }

    @Override
    public List<VisaPrice> list(Long visaCountryId) {
        return visaPriceMapper.list(visaCountryId);
    }

    @Override
    public void save(VisaManager record) {
        visaManagerMapper.insert(record);
    }

    @Override
    public PageInfo selectForListManager(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<VisaManager> list = visaManagerMapper.selectForList(qo);
        return new PageInfo(list);
    }

    @Override
    public List<VisaPrice> getCountrysByState(int state) {
        return visaPriceMapper.selectForCountry(state);
    }
}
